/// _sidenav.scss -*- Mode: scss; indent-tabs-mode: nil; basic-offset: 2 -*-

$sidenavCategoryColorActive:    lighten($blue, 30%);
$sidenavItemHeight:             $baseLineHeight + 6px; // line-height + padding
$sidenavItemBulletSize:         8px;
$sidenavSubsectionColor:        darken($navbarInverseText, 30%);

/**
 * Sidenav is fixed on the left side of the viewpane and dark by default.
 * Right content has to be offset accordingly.
 * See _responsive-sidenav.scss.
 */
.sidenav {
  @extend .navbar-inverse;
  border-color: $navbarInverseBorder;
  margin-left: 0;
  overflow: hidden;
  overflow-y: auto;
  padding-top: $baseFontSize;
  top: $navbarHeight;
  bottom: 0;
}

/**
 * Fluid row without gutter.
 */
.sidenav-fluid {
  @include grid-fluid($fluidGridColumnWidth + $fluidGridGutterWidth, 0);
  .row-fluid [class*="span"].hide {
    display: none;
  }
}

/**
 * Icon-based navigation list.
 */
.sidenav-icon-list {
  li a {
    height: 2em;
    padding: 11px 0;
    text-align: center;
  }
}

.sidenav {
  .nav-header,
  .nav-header li {
    color: $sidenavCategoryColorActive;
    text-shadow: none;
  }

  // A link in a header is an icon, usually a link to the documentation
  .nav-header a {
    display: inline-block;
    font-size: 1rem;
    position: relative;
    bottom: -2px;
  }

  .nav > li > a:hover {
    color: darken($navbarInverseLinkColorHover, 20%);
  }

  .nav .active > a,
  .nav .active > a:hover {
    background-color: initial;
  }

  .sidenav-subsection {
    position: relative;
    &.active > a {
      background: transparent !important;
    }
    // The line
    &:not(:last-child):not(.sidenav-subsection--last)::before {
      content: '';
      position: absolute;
      background: $sidenavSubsectionColor;
      width: 2px;
      height: $sidenavItemHeight - $sidenavItemBulletSize;
      left: $sidenavItemBulletSize/2 - 1px;
      top: ($sidenavItemHeight + $sidenavItemBulletSize)/2 - 1px;
    }
    &:last-child::before {
      //height: ($baseLineHeight + 6px) / 2; // line-height + padding
    }
    // The circle
    &::after {
      background-color: $navbarInverseBorder;
      border: 2px solid $sidenavSubsectionColor;
      top: 50%;
      left: 0;
      width: $sidenavItemBulletSize;
      height: $sidenavItemBulletSize;
      margin: -5px 0 0 0;
      border-radius: 50%;
      content: '';
      position: absolute;
      box-sizing: border-box;
      transition: transform 0.3s, border-color 0.3s, border-width 0.3s;
    }
    &:not(.active):hover::after {
      background-color: $white;
      border-color: $white;
    }
    &.active::after {
      border-width: 1px;
      border-color: $white;
      transform: scale3d(1.6,1.6,1);
    }
    a {
      //@include gradient-vertical(darken($navbarInverseBackgroundHighlight, 10%), darken($navbarInverseBackground, 10%));
      overflow: hidden;
      padding-left: 2.5em;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .sidenav-subsection-extend {
    list-style: none;
    position: relative;
    &::before {
      content: '';
      position: absolute;
      background: $sidenavSubsectionColor;
      margin-left: -25px; // counter padding of ul (see _type.scss)
      width: 2px;
      height: $sidenavItemHeight;
      left: $sidenavItemBulletSize/2 - 1px;
      top: $sidenavItemBulletSize;
    }
  }
  p.sidenav-item {
        margin-top:5px;
        margin-bottom:0px;
  }
  p.sidenav-description {
        margin-top:0px;
        margin-bottom:5px;
        font-style:italic;
  }
}

.sidenav-category,
.sidenav-category-extend {
  @include gradient-vertical($navbarInverseBackgroundHighlight, $navbarInverseBackground);

  &.sidenav .nav .active > a,
  &.sidenav .nav .active > a:hover,
  &.sidenav .nav .active > a:focus {
    background-color: initial;
    color: $sidenavCategoryColorActive;
    text-shadow: 0 0 6px $sidenavCategoryColorActive;
  }

  &.sidenav .nav > li > a {
    background-color: transparent;
    transition: background-color 0.3s ease-in-out;
  }

  &.sidenav .nav > li > a:hover,
  &.sidenav.sidenav-category-extend [data-category],
  &.sidenav.sidenav-category-extend [data-category] a {
    color: $black;
    background-color: $sidenavCategoryColorActive;
    transition: all 0.3s ease-in-out;
  }
}

/**
 * Tooltips for icon-based categories
 */
.sidenav-category-extend {
  background-color: transparent;
  background-image: none;
  display: none; // hidden by default

  &.show {
    display: block;
    z-index: $zindexTooltip;
  }

  [data-category] {
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
    transform: translateX(-20%);

    &.show {
      box-shadow: -30px 0px 30px 10px rgba(0,0,0,0.75);
      opacity: 1;
      transform: translateX(0%);
    }

    a {
      font-size: 1em;
    }
  }
}

.sidenav-section {
  @include gradient-vertical($navbarInverseBackgroundHighlight, lighten($navbarInverseBackground, 10%));

  &.sidenav .nav .active > a {
    @include gradient-horizontal(lighten($navbarInverseBackgroundHighlight, 5%), lighten($navbarInverseBackgroundHighlight, 10%));
  }
}

.sidenav .nav-list .pull-right {
  margin-left: 1em;
}

.sidenav .nav-list .nav-list {
  padding: 0;
}

/**
 * Subtle divider to separate sections
 */
.sidenav .divider {
  background-color: lighten($navbarInverseBackgroundHighlight, 10%);
  border-bottom-color: lighten($navbarInverseBackground, 10%);
}

/**
 * Glowing divider to be placed under the headers
 */
.sidenav .divider-horizontal {
  border-top: 1px solid $sidenavCategoryColorActive;
  box-shadow: 0 0 6px $sidenavCategoryColorActive;
}

/**
 * Style the scrollbar for browsers that support it
 */
.sidenav {
  &::-webkit-scrollbar {
    background-color: $navbarInverseBackground;
    width: 10px;
  }
  &::-webkit-scrollbar-thumb {
    background-color: $gray;
    border-radius: 10px;
  }
  &::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    background-color: lighten($navbarInverseBackground, 5%);
    border-radius: 10px;
  }
}
